package router

import (
	platformController "gitee.com/wangshh_123/cross-pay-go/src/controller/platform"
	"gitee.com/wangshh_123/cross-pay-go/src/middleware"
	"gitee.com/wangshh_123/cross-pay-go/src/platform/providers/juswaypay"
	"github.com/gin-gonic/gin"
)

// SetupJuswayPayRouter sets up the JuswayPay router
func SetupJuswayPayRouter(api *gin.RouterGroup, client *juswaypay.JuswayPayClient) {
	// 创建聚实汇控制器实例
	juswayPayController := platformController.NewJuswayPayController(client)

	// 聚实汇路由组
	juswayPay := api.Group("/juswaypay")
	{
		// 用户相关路由
		users := juswayPay.Group("/users")
		users.Use(middleware.AuthMiddleware())
		{
			users.GET("/info", juswayPayController.GetUserInfo)
		}

		// 会员中心路由
		member := juswayPay.Group("/member")
		member.Use(middleware.AuthMiddleware())
		{
			member.GET("/center", juswayPayController.GetMemberCenter)
		}

		// 卡相关路由
		card := juswayPay.Group("/card")
		card.Use(middleware.AuthMiddleware())
		{
			card.GET("/scenario", juswayPayController.GetCardScenario)
			card.GET("/bin-range", juswayPayController.GetCardBinRange)
			card.GET("/channel", juswayPayController.GetChannelList)
			card.POST("/holder", juswayPayController.CreateCardHolder)
			card.POST("/apply", juswayPayController.ApplyCard)
			card.POST("/recharge", juswayPayController.RechargeCard)
			card.POST("/refund", juswayPayController.RefundCard)
		}
	}
}
